package cn.hzc.fortess.system.dao;

import cn.hzc.fortess.system.entity.Menu;
import cn.hzc.fortess.system.node.MenuNode;
import cn.hzc.fortess.system.node.ZTreeNode;
import cn.hzc.fortess.system.search.MenuSearch;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MenuDao {

    int delete(Integer id);

    Integer getRootMenuIdByProjectId(Integer projectId);

    List<Integer> findMenuIdListByRole(Integer roleId);

    int deleteRelationByMenu(Integer id);

    int deleteRoleRelationByMenu(Integer id);

    int insert(Menu record);

    int insertResourceScope(@Param("resourceId") Integer resourceId,@Param("resourceScope")Integer resourceScope);

    int updateResourceScope(@Param("resourceId") Integer resourceId,@Param("resourceScope")Integer resourceScope);

    Integer findScopeByResourceId(Integer resourceId);

    Menu findById(Integer id);

    Menu findByAuthIdent(String authIdent);

    int update(Menu record);

    List<Menu> findMenus(MenuSearch search);

    List<Menu> findDataMenu(Integer projectId);

    List<MenuNode> getSamMenusByRoleIds(@Param("projectId")Integer projectId, @Param("roleIds") List<Integer> roleIds);

    List<Menu> page(MenuSearch search);

    long count(MenuSearch search);

    List<ZTreeNode> menuTreeList(@Param("projectIds") List<Integer> projectIds);

    List<Menu> findEnableAuthMenus(@Param("projectId") Integer projectId);

    List<Menu> selectMenuList(MenuSearch search);

    List<String> findMenuPermissionListByRoleId(@Param("roleIds") List<Integer> roleIds);

}